{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "fresh-convention",
   "metadata": {},
   "source": [
    "<center><h1>第二次作业</h1></center>\n",
    "<center>3018233061 樊一飞<center>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "drawn-jacket",
   "metadata": {},
   "source": [
    "## 1.求导数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "substantial-gazette",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "              2      3                    2      3    4\n",
       "2    2 x + 6 x  + 4 x     2 Log[x]   Log[x  + 2 x  + x ]\n",
       "-- - ------------------ - -------- + -------------------\n",
       " 2       2      3    4        2               2\n",
       "x    x (x  + 2 x  + x )      x               x"
      ]
     },
     "execution_count": 1,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "D[2/x Log[x]-1/x Log[x^4+2 x^3+x^2],x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "micro-melissa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "  1   1\n",
       "-(-) ----\n",
       "  2   3/2\n",
       "     x"
      ]
     },
     "execution_count": 2,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "D[Sin[ArcSin[1/Sqrt[x]]],x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "robust-induction",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "   ArcTan[1/x]\n",
       "  E\n",
       "-(------------) + Csc[x] Sec[x]\n",
       "        -2   2\n",
       "  (1 + x  ) x"
      ]
     },
     "execution_count": 3,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "D[Exp[ArcTan[1/x]]+Log[Tan[x]],x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "patient-reunion",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "         2\n",
       "ArcSin[x]"
      ]
     },
     "execution_count": 4,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "D[x(ArcSin[x])^2+2Sqrt[1-x^2]ArcSin[x]-2x,x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "hispanic-yesterday",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "                                                    2\n",
       "-2 Sin[2 x] f'[Cos[2 x]] + 2 Cos[x] Sin[x] f'[Sin[x] ]"
      ]
     },
     "execution_count": 6,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "D[f[Sin[x]^2]+f[Cos[2 x]],x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "driven-regulation",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "      Sqrt[Cos[x]]           Sqrt[Cos[x]]\n",
       "  1  a             Sin[x]   a             Log[a] Sin[x]\n",
       "-(-) -------------------- - ---------------------------\n",
       "  2      Sqrt[Cos[x]]                    2"
      ]
     },
     "execution_count": 8,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "D[Sqrt[Cos[x]]a^Sqrt[Cos[x]],x]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "continent-government",
   "metadata": {},
   "source": [
    "## 2.求微分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "approximate-segment",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "                Cos[x] Dt[x] (1 - Sin[x])    Cos[x] Dt[x]\n",
       "(1 + Sin[x]) (-(-------------------------) - ------------)\n",
       "                                  2           1 + Sin[x]\n",
       "                      (1 + Sin[x])\n",
       "----------------------------------------------------------\n",
       "                      2 (1 - Sin[x])"
      ]
     },
     "execution_count": 9,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Dt[Log[Sqrt[(1-Sin[x])/(1+Sin[x])]]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "representative-excuse",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "              2\n",
       "2 Dt[x] Sec[x]  Tan[x]\n",
       "----------------------\n",
       "               4\n",
       "     1 + Tan[x]"
      ]
     },
     "execution_count": 10,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Dt[ArcTan[Tan[x]^2]]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "individual-bradley",
   "metadata": {},
   "source": [
    "## 3.求高阶导数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "serial-export",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       " 2 x\n",
       "------ + 2 ArcTan[x]\n",
       "     2\n",
       "1 + x"
      ]
     },
     "execution_count": 11,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "D[(1+x^2)ArcTan[x],{x,2}]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "pressed-mortgage",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "    2 x               2 x\n",
       "12 E    Cos[3 x] - 5 E    Sin[3 x]"
      ]
     },
     "execution_count": 13,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "D[Exp[2 x]Sin[3 x],{x,2}]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "silent-queen",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "                                  2\n",
       "             x       2           x                1\n",
       "  (1 + -------------)     -(------------) + -------------\n",
       "             2    2           2    2 3/2          2    2\n",
       "       Sqrt[a  + x ]        (a  + x )       Sqrt[a  + x ]\n",
       "-(--------------------) + -------------------------------\n",
       "             2    2  2                     2    2\n",
       "  (x + Sqrt[a  + x ])            x + Sqrt[a  + x ]"
      ]
     },
     "execution_count": 14,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "D[Log[x+Sqrt[x^2+a^2]],{x,2}]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "driven-sentence",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "                    -1 - n      1                       1\n",
       "Piecewise[{{((1 - x)       + -------) n!, n >= 1}}, ---------]\n",
       "                                 n                  (1 - x) x\n",
       "                             (-x)  x"
      ]
     },
     "execution_count": 16,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "D[1/(x(1-x)),{x,n}]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "straight-technical",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "-517246483022336361285928710307223959938395264778240000000000\n",
       "-------------------------------------------------------------\n",
       "                              48\n",
       "                             x"
      ]
     },
     "execution_count": 19,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "D[x^2 Log[x],{x,50}]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "hearing-charm",
   "metadata": {},
   "source": [
    "## 4.求参数函数的一阶二阶导数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "ruled-elements",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "                   2                                2\n",
       "          -2   -2 t        2 t          2        6 t        8 t         2\n",
       "{{-(1 + t)  , -------- + --------}, {--------, -------- - -------- + --------}}\n",
       "                     3          2           3         4          3          2\n",
       "              (1 + t)    (1 + t)     (1 + t)   (1 + t)    (1 + t)    (1 + t)"
      ]
     },
     "execution_count": 24,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x=1/(1+t);\n",
    "y=t^2/(1+t)^2;\n",
    "{D[{x,y},t],D[{x,y},{t,2}]}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "governmental-yellow",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "       t          (-1 + t) t          1\n",
       "{{------------, -(-----------) + ------------}, \n",
       "            2           2 3/2              2\n",
       "  Sqrt[1 + t ]    (1 + t )       Sqrt[1 + t ]\n",
       " \n",
       "            2\n",
       "           t               1\n",
       ">   {-(-----------) + ------------, \n",
       "             2 3/2              2\n",
       "       (1 + t )       Sqrt[1 + t ]\n",
       " \n",
       "                                   2\n",
       "        -2 t                    3 t              2 -(3/2)\n",
       ">    ----------- + (-1 + t) (----------- - (1 + t )      )}}\n",
       "           2 3/2                   2 5/2\n",
       "     (1 + t )                (1 + t )"
      ]
     },
     "execution_count": 27,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x=Sqrt[t^2+1];\n",
    "y=(t-1)/Sqrt[1+t^2];\n",
    "{D[{x,y},t],D[{x,y},{t,2}]}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "collect-academy",
   "metadata": {},
   "outputs": [],
   "source": [
    "Clear[x,y]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "placed-repair",
   "metadata": {},
   "source": [
    "## 5.利用微分求函数的近似值\n",
    "### 利用一阶Taylor展开\n",
    "\n",
    "$$\n",
    "f(x)=f(x_0)+(x-x_0) f^{'}(x_0)+o(|x-x_0|)\n",
    "$$\n",
    "\n",
    "其中$f(x)$是未知的，$x_0$是靠近$x$的一点且$f(x_0)$已知，$f^{'}(x)$可算\n",
    "\n",
    "所以可以用$f(x_0)+(x-x_0) f^{'}(x_0)$作为$f(x)$的近似值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "happy-labor",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "f[x0] + (x - x0) f'[x0]"
      ]
     },
     "execution_count": 61,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Nf[f_,x0_,x_]=f[x0]+(x-x0)D[f[t],t]/.t->x0"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "elegant-concentration",
   "metadata": {},
   "source": [
    "(1) 计算 $\\arcsin 0.51$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "earned-internet",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><pre style=\"&#102;&#111;&#110;&#116;&#45;&#102;&#97;&#109;&#105;&#108;&#121;&#58;&#32;&#34;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#32;&#78;&#101;&#119;&#34;&#44;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#44;&#109;&#111;&#110;&#111;&#115;&#112;&#97;&#99;&#101;&#59;\">&#48;&#46;&#53;&#50;&#51;&#53;&#53;&#57;</pre></div>"
      ],
      "text/plain": [
       "0.523559"
      ]
     },
     "execution_count": 51,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Nf[ArcSin,0.51,0.5]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "extraordinary-amber",
   "metadata": {},
   "source": [
    "(2) 计算 ${126}^{\\frac13}$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "front-token",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><pre style=\"&#102;&#111;&#110;&#116;&#45;&#102;&#97;&#109;&#105;&#108;&#121;&#58;&#32;&#34;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#32;&#78;&#101;&#119;&#34;&#44;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#44;&#109;&#111;&#110;&#111;&#115;&#112;&#97;&#99;&#101;&#59;\">&#53;&#46;&#48;&#48;&#48;&#48;&#52;</pre></div>"
      ],
      "text/plain": [
       "5.00004"
      ]
     },
     "execution_count": 59,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f[x_] = x^(1/3);\n",
    "N[Nf[f,126,125]]\n",
    "Clear[f];"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "duplicate-newman",
   "metadata": {},
   "source": [
    "### 利用级数展开\n",
    "`Series[f,{x,x0,n}}]`"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "virtual-building",
   "metadata": {},
   "source": [
    "(1) 计算 $\\arcsin 0.51$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "id": "abstract-malta",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><pre style=\"&#102;&#111;&#110;&#116;&#45;&#102;&#97;&#109;&#105;&#108;&#121;&#58;&#32;&#34;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#32;&#78;&#101;&#119;&#34;&#44;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#44;&#109;&#111;&#110;&#111;&#115;&#112;&#97;&#99;&#101;&#59;\">&#48;&#46;&#53;&#51;&#53;&#49;&#56;&#53;</pre></div>"
      ],
      "text/plain": [
       "0.535185"
      ]
     },
     "execution_count": 68,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Normal[Series[ArcSin[x],{x,.5,5}]]/.x->.51"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "sunrise-flesh",
   "metadata": {},
   "source": [
    "(2) 计算 ${126}^{\\frac13}$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "id": "severe-wedding",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><pre style=\"&#102;&#111;&#110;&#116;&#45;&#102;&#97;&#109;&#105;&#108;&#121;&#58;&#32;&#34;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#32;&#78;&#101;&#119;&#34;&#44;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#44;&#109;&#111;&#110;&#111;&#115;&#112;&#97;&#99;&#101;&#59;\">&#53;&#46;&#48;&#49;&#51;&#51;</pre></div>"
      ],
      "text/plain": [
       "5.0133"
      ]
     },
     "execution_count": 71,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "N[Normal[Series[x^(1/3),{x,125,5}]]/.x->126]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "animal-reunion",
   "metadata": {},
   "source": [
    "## 6.求不定积分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "pleasant-store",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "             1 + 2 x\n",
       "    4 ArcTan[-------]\n",
       "             Sqrt[3]                 2\n",
       "x - ----------------- - Log[1 + x + x ]\n",
       "         Sqrt[3]"
      ]
     },
     "execution_count": 62,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Integrate[(x^2-x-2)/(1+x+x^2),x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "neither-large",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "                           2\n",
       "                  Log[1 + x ]\n",
       "x - 3 ArcTan[x] - -----------\n",
       "                       2"
      ]
     },
     "execution_count": 63,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Integrate[(x^2-x-2)/(1+x^2),x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "id": "polish-fleece",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "                      2                         2\n",
       "Log[-1 + Sqrt[2] x - x ] - Log[1 + Sqrt[2] x + x ]\n",
       "--------------------------------------------------\n",
       "                    2 Sqrt[2]"
      ]
     },
     "execution_count": 64,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Integrate[(x^2-1)/(1+x^4),x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "id": "rising-welsh",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "-ArcTan[1 - Sqrt[2] x] + ArcTan[1 + Sqrt[2] x]\n",
       "----------------------------------------------\n",
       "                   Sqrt[2]"
      ]
     },
     "execution_count": 65,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Integrate[(x^2+1)/(1+x^4),x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "id": "bigger-amazon",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "2 Sqrt[1 + x] - 6 ArcTanh[Sqrt[1 + x]]"
      ]
     },
     "execution_count": 72,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Integrate[(x+3)/(x Sqrt[x+1]),x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "id": "coastal-rocket",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "                  x        x                 x        x\n",
       "3 x + 4 Log[3 Cos[-] - Sin[-]] - 4 Log[3 Cos[-] + Sin[-]]\n",
       "                  2        2                 2        2\n",
       "---------------------------------------------------------\n",
       "                           15"
      ]
     },
     "execution_count": 73,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Integrate[1/(5+4 Sec[x]),x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "id": "greatest-computer",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "            Cos[2 x]\n",
       "-2 Cos[x] + -------- + 3 Log[2 + Cos[x]]\n",
       "               4"
      ]
     },
     "execution_count": 74,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Integrate[Sin[x]^3/(2+Cos[x]),x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "id": "promising-visit",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "Log[5 Cos[x] - Sin[x]]   Log[Sin[x]]\n",
       "---------------------- - -----------\n",
       "          5                   5"
      ]
     },
     "execution_count": 76,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Integrate[1/(Sin[x]^2-5Sin[x]Cos[x]),x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "id": "cooked-mortality",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "       x\n",
       "-(-----------)\n",
       "  -x + Log[x]"
      ]
     },
     "execution_count": 77,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Integrate[(1-Log[x])/(x-Log[x])^2,x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "id": "responsible-revision",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "                                                       x\n",
       "             x                              Sqrt[-2 + E ]\n",
       "2 Sqrt[-2 + E ] (-2 + x) + 4 Sqrt[2] ArcTan[-------------]\n",
       "                                               Sqrt[2]"
      ]
     },
     "execution_count": 78,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Integrate[x Exp[x]/Sqrt[Exp[x]-2],x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "id": "fifteen-brave",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "           -1 + x                3 + x                     3 + x          Sqrt[1 - x]\n",
       "2 Sqrt[1 + ------] (-1 + x) Sqrt[------]   4 (-1 + x) Sqrt[------] ArcSin[-----------]\n",
       "             4                   -1 + x                    -1 + x              2\n",
       "---------------------------------------- + ------------------------------------------- - \n",
       "              Sqrt[3 + x]                            Sqrt[1 - x] Sqrt[3 + x]\n",
       " \n",
       "                -1 + x                -1 + x\n",
       ">   (4 Sqrt[1 + ------] (-1 + x) Sqrt[------] Sqrt[3 + x] \n",
       "                  4                   3 + x\n",
       " \n",
       "                                    Sqrt[1 - x]\n",
       "                 Sqrt[1 - x] ArcSin[-----------]\n",
       "        -1 + x                           2                  2\n",
       ">      (------ + -------------------------------)) / (1 - x)\n",
       "          2                      -1 + x\n",
       "                        Sqrt[1 + ------]\n",
       "                                   4"
      ]
     },
     "execution_count": 79,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Integrate[Sqrt[(x+3)/(x-1)]-Sqrt[(x-1)/(x+3)],x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "id": "sonic-guitar",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "                      u                      u\n",
       "               Sqrt[-----]    ArcTanh[Sqrt[-----]]\n",
       "          u         1 + u                  1 + u\n",
       "Sqrt[u] + - - ------------- - --------------------\n",
       "          2            u               2\n",
       "              2 (1 - -----)\n",
       "                     1 + u"
      ]
     },
     "execution_count": 82,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Integrate[1/(1+Sqrt[u]+Sqrt[1+u]),u]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "immune-pillow",
   "metadata": {},
   "source": [
    "## 7.解答\n",
    "设$f(\\ln x)=\\frac{\\ln(1+x)}x$,求$\\int f(x) d x $\n",
    "\n",
    "解：\n",
    "化简得$f(x)=\\frac{\\ln(1+e^x)}{e^x}$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "id": "initial-johnston",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "           -x           x\n",
       "x + (-1 - E  ) Log[1 + E ]"
      ]
     },
     "execution_count": 83,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Integrate[Log[1+Exp[x]]/Exp[x],x]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dimensional-scratch",
   "metadata": {},
   "source": [
    "## 8.解答\n",
    "设$f(x)$满足\n",
    "$\n",
    "f^{'}(x)=\n",
    "\\begin{cases}\n",
    "x^2, \\quad x\\leq 0\\\\\n",
    "\\sin x, \\quad x>0\n",
    "\\end{cases}\n",
    "$\n",
    "\n",
    "求$f(x)$和$\\int f(x)d x$,并在同一坐标系中画出$f(x)$,$f^{'}(x)$,$\\int f(x)d x$的图形\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "id": "described-somalia",
   "metadata": {},
   "outputs": [],
   "source": [
    "Clear[\"Global`*\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "id": "electoral-isolation",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "            2\n",
       "If[x <= 0, x , Sin[x]]"
      ]
     },
     "execution_count": 89,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f'[x_] = If[x<=0,x^2,Sin[x]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "id": "overall-energy",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "             3\n",
       "            x\n",
       "Piecewise[{{--, x <= 0}}, 1 - Cos[x]]\n",
       "            3"
      ]
     },
     "execution_count": 90,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f[x_] = Integrate[f'[x],x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "id": "subject-photography",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "             4\n",
       "            x\n",
       "Piecewise[{{--, x <= 0}}, x - Sin[x]]\n",
       "            12"
      ]
     },
     "execution_count": 91,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "F[x_] = Integrate[f[x],x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "id": "passing-impact",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "Legended[-Graphics-, Placed[LineLegend[{Directive[Opacity[1.], \n",
       " \n",
       ">       RGBColor[0.368417, 0.506779, 0.709798], AbsoluteThickness[1.6]], \n",
       " \n",
       ">      Directive[Opacity[1.], RGBColor[0.880722, 0.611041, 0.142051], \n",
       " \n",
       ">       AbsoluteThickness[1.6]], Directive[Opacity[1.], \n",
       " \n",
       ">       RGBColor[0.560181, 0.691569, 0.194885], AbsoluteThickness[1.6]]}, \n",
       " \n",
       ">     {f'(x), f(x), F(x)}, LegendMarkers -> None, LabelStyle -> {}, \n",
       " \n",
       ">     LegendLayout -> Column], After, Identity]]"
      ]
     },
     "execution_count": 93,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Plot[{f'[x],f[x],F[x]},{x,-5,5},PlotLegends->{\"f'(x)\",\"f(x)\",\"F(x)\"}]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "contemporary-meter",
   "metadata": {},
   "source": [
    "> 注：这里$F(x):=\\int f(x) dx$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 181,
   "id": "reasonable-heath",
   "metadata": {},
   "outputs": [],
   "source": [
    "Clear[\"Global`*\"]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "freelance-portrait",
   "metadata": {},
   "source": [
    "## 10.计算广义积分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "id": "dirty-platinum",
   "metadata": {},
   "outputs": [
    {
     "ename": "Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.",
     "evalue": "Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31mNumerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.\u001b[0m"
     ]
    },
    {
     "ename": "NIntegrate failed to converge to prescribed accuracy after `1` recursive bisections in `2` near `3` = `4`. NIntegrate obtained `5` and `6` for the integral and error estimates.",
     "evalue": "NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in x near {x} = {0.00385963}. NIntegrate obtained -1.21483 - 4.70967 I and 6.01029 for the integral and error estimates.",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31mNIntegrate failed to converge to prescribed accuracy after `1` recursive bisections in `2` near `3` = `4`. NIntegrate obtained `5` and `6` for the integral and error estimates.: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in x near {x} = {0.00385963}. NIntegrate obtained -1.21483 - 4.70967 I and 6.01029 for the integral and error estimates.\u001b[0m"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "-1.21483 - 4.70967 I"
      ]
     },
     "execution_count": 124,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "NIntegrate[1/(x Sqrt[x^2-1]),{x,-2,1}]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "id": "remarkable-iraqi",
   "metadata": {},
   "outputs": [
    {
     "ename": "Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.",
     "evalue": "Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31mNumerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.\u001b[0m"
     ]
    },
    {
     "ename": "NIntegrate failed to converge to prescribed accuracy after `1` recursive bisections in `2` near `3` = `4`. NIntegrate obtained `5` and `6` for the integral and error estimates.",
     "evalue": "NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in x near {x} = {1.57688}. NIntegrate obtained 61466. and 51448.9 for the integral and error estimates.",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31mNIntegrate failed to converge to prescribed accuracy after `1` recursive bisections in `2` near `3` = `4`. NIntegrate obtained `5` and `6` for the integral and error estimates.: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in x near {x} = {1.57688}. NIntegrate obtained 61466. and 51448.9 for the integral and error estimates.\u001b[0m"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div><pre style=\"&#102;&#111;&#110;&#116;&#45;&#102;&#97;&#109;&#105;&#108;&#121;&#58;&#32;&#34;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#32;&#78;&#101;&#119;&#34;&#44;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#44;&#109;&#111;&#110;&#111;&#115;&#112;&#97;&#99;&#101;&#59;\">&#54;&#49;&#52;&#54;&#54;&#46;</pre></div>"
      ],
      "text/plain": [
       "61466."
      ]
     },
     "execution_count": 126,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "NIntegrate[Cos[x]^(-2),{x,-Pi/4,3Pi/4}]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 132,
   "id": "allied-central",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><pre style=\"&#102;&#111;&#110;&#116;&#45;&#102;&#97;&#109;&#105;&#108;&#121;&#58;&#32;&#34;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#32;&#78;&#101;&#119;&#34;&#44;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#44;&#109;&#111;&#110;&#111;&#115;&#112;&#97;&#99;&#101;&#59;\">&#51;&#46;&#54;&#50;&#55;&#54;</pre></div>"
      ],
      "text/plain": [
       "3.6276"
      ]
     },
     "execution_count": 132,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "NIntegrate[1/(x^2+x+1),{x,-Infinity,Infinity}]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 133,
   "id": "regular-species",
   "metadata": {},
   "outputs": [
    {
     "ename": "NIntegrate failed to converge to prescribed accuracy after `1` recursive bisections in `2` near `3` = `4`. NIntegrate obtained `5` and `6` for the integral and error estimates.",
     "evalue": "                                                                                                                                                                                                       65               65\nNIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in x near {x} = {0.99999999999999999999999999999999999999999999999999999999843473555}. NIntegrate obtained 2.19521 10   and 2.19519 10   for the integral and error estimates.",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m                                                                                                                                                                                                                                                                                                                                                                                         65               65\nNIntegrate failed to converge to prescribed accuracy after `1` recursive bisections in `2` near `3` = `4`. NIntegrate obtained `5` and `6` for the integral and error estimates.: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in x near {x} = {0.99999999999999999999999999999999999999999999999999999999843473555}. NIntegrate obtained 2.19521 10   and 2.19519 10   for the integral and error estimates.\u001b[0m"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div><pre style=\"&#102;&#111;&#110;&#116;&#45;&#102;&#97;&#109;&#105;&#108;&#121;&#58;&#32;&#34;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#32;&#78;&#101;&#119;&#34;&#44;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#44;&#109;&#111;&#110;&#111;&#115;&#112;&#97;&#99;&#101;&#59;\">&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#32;&#54;&#53;&#10;&#50;&#46;&#49;&#57;&#53;&#50;&#49;&#32;&#49;&#48;</pre></div>"
      ],
      "text/plain": [
       "          65\n",
       "2.19521 10"
      ]
     },
     "execution_count": 133,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "NIntegrate[Sin[1-x]^(-2),{x,0,1}]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 134,
   "id": "extraordinary-expert",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><pre style=\"&#102;&#111;&#110;&#116;&#45;&#102;&#97;&#109;&#105;&#108;&#121;&#58;&#32;&#34;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#32;&#78;&#101;&#119;&#34;&#44;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#44;&#109;&#111;&#110;&#111;&#115;&#112;&#97;&#99;&#101;&#59;\">&#51;&#53;&#46;&#54;&#53;&#54;&#53;</pre></div>"
      ],
      "text/plain": [
       "35.6565"
      ]
     },
     "execution_count": 134,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "NIntegrate[x Exp[x-(x-2)^2],{x,2,Infinity}]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 162,
   "id": "particular-battle",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "                            1\n",
       "                      Gamma[- + m]\n",
       "                            2                 1\n",
       "ConditionalExpression[------------, Re[m] > -(-)]\n",
       "                           2                  2"
      ]
     },
     "execution_count": 162,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Integrate[x^(2 m)Exp[-x^2],{x,0,Infinity}]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "veterinary-watson",
   "metadata": {},
   "source": [
    "## 11.曲线积分\n",
    "计算曲线$y=\\ln(1-x^2)$相应于$0\\leq x\\leq \\frac12$的一段弧长\n",
    "\n",
    "弧长积分公式：\n",
    "\n",
    "$\\int_{C} d s=\\int \\sqrt{1+(\\frac{d y}{d x})^2}d x$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 135,
   "id": "conservative-spirituality",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><pre style=\"&#102;&#111;&#110;&#116;&#45;&#102;&#97;&#109;&#105;&#108;&#121;&#58;&#32;&#34;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#32;&#78;&#101;&#119;&#34;&#44;&#67;&#111;&#117;&#114;&#105;&#101;&#114;&#44;&#109;&#111;&#110;&#111;&#115;&#112;&#97;&#99;&#101;&#59;\">&#48;&#46;&#53;&#57;&#56;&#54;&#49;&#50;</pre></div>"
      ],
      "text/plain": [
       "0.598612"
      ]
     },
     "execution_count": 136,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y=Log[1-x^2];\n",
    "NIntegrate[Sqrt[1+D[y,x]^2],{x,0,1/2}]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "advised-forty",
   "metadata": {},
   "source": [
    "## 12.解答\n",
    "求函数$\\phi(x)=\\int_0^x1+t-\\frac{t^2}3 dt$在$[0,10]$之间的最大值\n",
    "\n",
    "解：\n",
    "\n",
    "(1) 变上限函数积分化简"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "id": "horizontal-ceremony",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "     2    3\n",
       "    x    x\n",
       "x + -- - --\n",
       "    2    9"
      ]
     },
     "execution_count": 107,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "phi[x_]=Integrate[1+t-t^2/3,{t,0,x}]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "corporate-decrease",
   "metadata": {},
   "source": [
    "(2)绘图并观察"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "id": "subsequent-weekend",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "Legended[-Graphics-, Placed[LineLegend[{Directive[Opacity[1.], \n",
       " \n",
       ">       RGBColor[0.368417, 0.506779, 0.709798], AbsoluteThickness[1.6]]}, {phi(x)}, \n",
       " \n",
       ">     LegendMarkers -> None, LabelStyle -> {}, LegendLayout -> Column], After, Identity]]"
      ]
     },
     "execution_count": 108,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Plot[phi[x],{x,0,10},PlotLegends->{\"phi(x)\"}]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "systematic-uruguay",
   "metadata": {},
   "source": [
    "**发现**：最大值应该在$x=4$附近取到"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "muslim-serum",
   "metadata": {},
   "source": [
    "(3) 利用`FindMaximum`命令求解"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "id": "lyric-bride",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "FindMaximum[f, x] searches for a local maximum in f\n",
       " \n",
       ">    , starting from an automatically selected point.FindMaximum[f, {x, x }]\n",
       "                                                                         0\n",
       " \n",
       ">      searches for a local maximum in f\n",
       " \n",
       ">      , starting from the point x = x\n",
       "                                      0\n",
       " \n",
       ">       . FindMaximum[f, {{x, x }, {y, y }, …}]\n",
       "                               0        0\n",
       " \n",
       ">         searches for a local maximum in a function of several variables. \n",
       "\n",
       " \n",
       ">         FindMaximum[{f, cons}, {{x, x }, {y, y }, …}]\n",
       "                                       0        0\n",
       " \n",
       ">          searches for a local maximum subject to the constraints cons\n",
       " \n",
       ">          .FindMaximum[{f, cons}, {x, y, …}]\n",
       "\n",
       " \n",
       ">            starts from a point within the region defined by the constraints.\n",
       "\n",
       "\n",
       "Attributes[FindMaximum]={HoldAll, Protected}\n",
       "\n",
       "\n",
       "Options[FindMaximum]={AccuracyGoal -> Automatic, Compiled -> Automatic, \n",
       " \n",
       ">    EvaluationMonitor -> None, Gradient -> Automatic, MaxIterations -> Automatic, \n",
       " \n",
       ">    Method -> Automatic, PerformanceGoal :> $PerformanceGoal, \n",
       " \n",
       ">    PrecisionGoal -> Automatic, StepMonitor -> None, \n",
       " \n",
       ">    WorkingPrecision -> MachinePrecision}"
      ]
     },
     "execution_count": 109,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "?FindMaximum"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "id": "increasing-accreditation",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "{4.92317, {x -> 3.79129}}"
      ]
     },
     "execution_count": 110,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "FindMaximum[{phi[x],0<=x<=10},{x,4}]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "overall-hardware",
   "metadata": {},
   "source": [
    "## 13.求隐函数的导数\n",
    "(1)$y=\\sin(x+y)$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "entire-placement",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "               Cos[x + y[x]]                    Sin[x + y[x]]\n",
       "{{y'[x] -> -(------------------), y''[x] -> ---------------------}}\n",
       "             -1 + Cos[x + y[x]]                                 3\n",
       "                                            (-1 + Cos[x + y[x]])"
      ]
     },
     "execution_count": 2,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "DerivateImplicitFunction[FuncEq_]:=Solve[D[FuncEq,x]&&D[FuncEq,{x,2}],{y'[x],y''[x]}]\n",
    "DerivateImplicitFunction[y[x] == Sin[x+y[x]]]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "drawn-diagram",
   "metadata": {},
   "source": [
    "(2)$\\arctan\\frac yx=\\ln{\\sqrt{x^2+y^2}}$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "documentary-pendant",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><img alt=\"Output\" src=\"\"></div>"
      ],
      "text/plain": [
       "                                   2       2\n",
       "           x + y[x]            2 (x  + y[x] )\n",
       "{{y'[x] -> --------, y''[x] -> --------------}}\n",
       "           x - y[x]                       3\n",
       "                                (x - y[x])"
      ]
     },
     "execution_count": 3,
     "metadata": {
      "text/html": [],
      "text/plain": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "DerivateImplicitFunction[ArcTan[y[x]/x] == Log[Sqrt[x^2+y[x]^2]]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "arctic-array",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Wolfram",
   "language": "Wolfram Language",
   "name": "wolframlanguage12.2"
  },
  "language_info": {
   "codemirror_mode": "mathematica",
   "file_extension": ".m",
   "mimetype": "application/vnd.wolfram.m",
   "name": "Wolfram Language",
   "pygments_lexer": "mathematica",
   "version": "12.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
